import requests

class Send_Requests(object):
    '''封装了一个发送接口请求的工具类'''
    def __init__(self):
        '''用来保存会话'''
        self.session=requests.Session()

    def send(self,method,url,data=None,json=None,params=None,headers=None):
        method = method.lower()
        if method == 'get':
            response=self.session.get(url,params=params,headers=headers)
        elif method=='post':
            response=self.session.post(url,data=data,headers=headers)
        elif method == 'post_json':
            response = self.session.post(url,json=json,headers=headers)
        elif method == 'delete':
            response =self.session.delete(url)

        return response
